package cn.sieis.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import cn.sieis.pojo.Project;
import cn.sieis.pojo.Student;
import cn.sieis.service.project.ProjectService;
import cn.sieis.service.student.StudentService;

@Controller
@RequestMapping("/front/student")
public class StudentFrontController {

	@Resource
	private StudentService studentService;

	@Resource
	private ProjectService projectService;

	@RequestMapping(value = "studentlist.html")
	public String studentlist(Model model) {
		return "front/studentlist";
	}

	@RequestMapping(value = "problem.html")
	public String about(Model model) {
		return "front/problem";
	}

	@RequestMapping(value = "/list.html")
	public String getStudentList(Model model, String stuName, Integer stuProject) {
		List<Student> studentlist = null;
		List<Project> projectList = null;
		try {
			studentlist = studentService.getStudentListFr(stuName, stuProject);
			projectList = projectService.getProjectListF(null, null);
		} catch (Exception e) {
			e.printStackTrace();
		}

		model.addAttribute("studentlist", studentlist);
		model.addAttribute("projectList", projectList);
		return "front/studentlist";

	}

}
